package com.moyuaninfo.service;

import com.moyuaninfo.entity.MyyWaterQualityData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.moyuaninfo.repository.MyyWaterQualityDataRepository;

/**
 * @author 邱祥霸
 * @date 2020-04-08
 */
@Component
public class MyyWaterQualityDataManger {

    @Autowired
    private MyyWaterQualityDataRepository myyWaterQualityDataRepository;

    /**
     * 获取最新的一条记录
     *
     * @return com.example.jpa.jap_demo.entity.MyyWaterQualityData
     *
     * @author 邱祥霸
     * @date 2020-04-08
     */
    public MyyWaterQualityData findMyyWaterQualityDataNew(Long equipmentWaterId) {
        return myyWaterQualityDataRepository.findMyyWaterQualityDataNew(equipmentWaterId);
    }

    /**
     * 保存水质数据
     *
     * @param myyWaterQualityData: 水质数据
     * @return com.example.jpa.jap_demo.entity.MyyWaterQualityData
     *
     * @author 邱祥霸
     * @date 2020-04-08
     */
    public MyyWaterQualityData save(MyyWaterQualityData myyWaterQualityData) {
        MyyWaterQualityData myyWaterQualityData1 = myyWaterQualityDataRepository.save(myyWaterQualityData);
        return myyWaterQualityData1;
    }
}
